package org.example.casemodule.enums;

public enum LawyerStatus {
    /**
     * "AVAILABLE","BUSY","PAUSED"
     */
    AVAILABLE("AVAILABLE", "可用"),
    BUSY("BUSY", "忙碌"),
    PAUSED("PAUSED", "暂停");

    private final String code;
    private final String info;
    LawyerStatus(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static LawyerStatus fromCode(String code) {
        for (LawyerStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }

    public static LawyerStatus fromInfo(String info) {
        for (LawyerStatus status : values()) {
            if (status.info.equals(info)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown info: " + info);
    }

    @Override
    public String toString() {
        return "LawyerStatus{" +
                "code='" + code + '\'' +
                ", info='" + info + '\'' +
                '}';
    }
}
